# -*- coding: utf-8 -*-
import time
import pytest
from config.config import NOW_ENV, Current_log_path, \
    test_request_parameters, beta_request_parameters, soa_request_parameters
from core import YamlLoad
from core.Client import run_test
from core.YamlLoad import write_center_params
from utils.Mysql import db
from utils.logger import log
from core.Login import web_login, app_login, C_login

def clear_extract_yaml():
    """
    清除extract_yaml文件内容
    :return:
    """
    YamlLoad.clear_center_params()








def clear_current_log():
    """清除上一次的执行日志"""
    with open(Current_log_path, "w") as f:
        f.write("")
    log.info('current_log文件清除完成.')


def delete_Log():
    """删除日志文件"""
    log.delete_log_file()
    log.info("=" * 60 + "Test Closure" + "=" * 60 + "\n" * 3)


@pytest.fixture(scope="session", autouse=True)
def session_control():
    # clear_extract_yaml()
    clear_current_log()
    # login()
    yield
    delete_Log()
    # now = time.strftime('%Y-%m-%d %H:%M:%S')
    # now_hour = parse(now).hour
    # if now_hour < release_hour:
    #     pass
    # else:
    # feishu_msg.send_msg()


# if __name__ == '__main__':
    # print(web_login())
    # print(C_login())
    # print(app_login())
